package com.hengpeng.itfin.service.ehcache.impl;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hengpeng.itfin.service.ehcache.EhchaceService;
import com.hengpeng.itfin.service.impl.BaseServiceImpl;


/**
 * <pre>
 * 更新缓存
 * </pre>
 * @version 1.0, 2011-3-22
 */
@Transactional
@Service
@Lazy
public class EhchaceServiceImpl extends BaseServiceImpl implements EhchaceService
{
	Logger logger = Logger.getLogger(this.getClass());

	@Autowired
	private BeanFactory beanFactory;

	@Override
	public void flushEhchaceByName(String ehchaceName)
	{
		//删除main 交易系统缓存
		CacheManager cachemanager = beanFactory.getBean("ehCacheManager", CacheManager.class);
		Cache cache = cachemanager.getCache(ehchaceName);
		cache.removeAll();
	}
}
